class Player:

    def output(self, currentRound, board, mode):
        '''暴力枚举单次的所有可能下棋/移动方式，选出代价估计价值最高的方式返回'''

        if mode == 'position':  # 给出己方下棋的位置            
            another = board.getNext(self.belong, currentRound)  # 己方的允许落子点            
            available = board.getNone(not self.belong)  # 对方的允许落子点
            
            bestchoice = None # 初始化当前选择            
            bestvalue = float('-inf') # 初始化当前代价（负无穷）
            
            if another != (): # 本方位置落子                  
                bestchoice = another                    
                bestvalue = self.cost_function(board,mode,another,self.belong)
                
            for pos in available: # 对方位置落子
                currentvalue = self.cost_function(board,mode,pos,not self.belong)                   
                if bestvalue < currentvalue:                        
                    bestvalue = currentvalue                        
                    bestchoice = pos       
            return bestchoice
            
        elif mode == 'direction':  # 给出己方合并的方向
            directionList = [0, 1, 2, 3]
            
            bestchoice = None # 初始化           
            bestvalue = float('-inf')

            for direction in directionList:                
                imitation = board.copy()
                if imitation.move(self.belong,direction): # board类的move函数自带调整棋盘，并返回是否变化                   
                    currentvalue = self.cost_function(board,mode)                   
                    if bestvalue < currentvalue:                       
                        bestvalue = currentvalue                        
                        bestchoice = direction
            return bestchoice

        else:
            return